var _Object$defineProperty = require("../core-js/object/define-property");

var _Object$defineProperties = require("../core-js/object/define-properties");

var _Object$getOwnPropertyDescriptors = require("../core-js/object/get-own-property-descriptors");

var _Object$getOwnPropertyDescriptor = require("../core-js/object/get-own-property-descriptor");

var _Object$getOwnPropertySymbols = require("../core-js/object/get-own-property-symbols");

var _Object$keys = require("../core-js/object/keys");

var defineProperty = require("./defineProperty");

function ownKeys(object, enumerableOnly) {
  var keys = _Object$keys(object);

  if (_Object$getOwnPropertySymbols) {
    keys.push.apply(keys, _Object$getOwnPropertySymbols(object));
  }

  if (enumerableOnly) keys = keys.filter(function (sym) {
    return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  });
  return keys;
}

function _objectSpread2(target) {
  for (var i = 1; i < arguments.length; i++) {
    if (i % 2) {
      var source = arguments[i] != null ? arguments[i] : {};
      ownKeys(source, true).forEach(function (key) {
        defineProperty(target, key, source[key]);
      });
    } else if (_Object$getOwnPropertyDescriptors) {
      _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(arguments[i]));
    } else {
      ownKeys(source).forEach(function (key) {
        _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(arguments[i], key));
      });
    }
  }

  return target;
}

module.exports = _objectSpread2;